// ---------全选效果------start
var check_num = 0;
$(function(){
	$("#checkAllChange").click(function() { // 全选/取消全选
		
		if (this.checked == true) { 
			$(".express_id").each(function() { 
				this.checked = true;		
			}); 
		} else { 
			$(".express_id").each(function() { 
				this.checked = false; 
			}); 
		} 
	}); 
	


	$(".express_id").each(function(index,element){//
		$(this).click(function(){			
			if(element.checked == false){//只要有一个元素为false
				$("#checkAllChange").attr("checked",false);
			}
			
		})

    });
	
	
}); 
	// ---------提交------start
var title_v = '<?php echo $title;?>';
function check(){
	var title = document.getElementById('title').value;
	if( title == "" ){
		win_alert('请输入名称');
		return false;
	}
	
	var express_ids = $('.express_id:checked').val();
	if(express_ids == null)
	{
		win_alert('请选择快递规则！');
		return false;
	}

	if(title == title_v){
		document.getElementById("myform").submit();
	}else{
		$.ajax({
			url: 'url',
			data: {title:title},
			type: 'post',
			dataType: 'json',
			success:function(res){
				console.log(res.status);
				if(res.status==1){
					win_alert('模板名称重名，请重新命名！');
					return false;
				}else{
					document.getElementById("myform").submit();
				}
			},
			error:function(er){
				
			}
		})
	}
	
	
}